﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Albon.Model;
using Commonlib;
namespace BLL
{
    public class ItemClothBLL
    {
        private readonly DAL.ItemClothDAL itemclothdal = new DAL.ItemClothDAL();
        /// <summary>
        /// 添加需要买布的样式到ItemCloth中
        /// </summary>
        public bool addItemCloth(ItemCloth itemcloth)
        {
            return itemclothdal.addItemCloth(itemcloth);
        }

        /// <summary>
        /// 添加已选择样式选择布料(OOS的布料重新选择后状态重新变为NoStatus)
        /// </summary>
        public bool selectCloth(ItemCloth itemcloth)
        {
            return itemclothdal.selectCloth(itemcloth);
        }

        /// <summary>
        /// 根据ID获取布料信息
        /// </summary>
        public DataTable getItemClothByID(string clothid)
        {
            return itemclothdal.getItemCloth("ID="+clothid);
        }

        /// <summary>
        /// 修改订单项尺寸
        /// </summary>
        public bool updateItemSize(ItemCloth itemcloth)
        {
            return itemclothdal.updateItemSize(itemcloth);
        }

        /// <summary>
        /// 根据订单项ID返回所有布料信息
        /// </summary>
        public DataTable getItemCloth(string orderitemid)
        {
            return itemclothdal.getItemCloth("orderitemID="+orderitemid);
        }

        /// <summary>
        /// 将已选择的optionCloth的active都设0,然后在添加样式信息的时候重新进行判断并添加
        /// </summary>
        public void clearOptionCloth(string orderitemid)
        {
            itemclothdal.clearCloth(orderitemid);
        }
        /// <summary>
        /// 返回一个订单中的所有布料信息
        /// </summary>
        /// <param name="orderid"></param>
        public DataTable getItemClothByOrderID(string orderid)
        {
            return itemclothdal.getItemCloth("orderID=" + orderid);
        }
    }
}
